import Login from './views/Login.vue'//登录
import Branch from './views/Branch.vue'//系统分支
import NotFound from './views/404.vue'
import Navs from './views/Navs.vue'
import Main from './views/Main.vue'
import echarts from './views/charts/echarts.vue'
import Cashier from './views/Header/Cashier.vue'
import Business from './views/Header/Business.vue'
import Home from './views/Header/Home.vue'

/*------------------------首页----------------------------*/
import alreadySponsor from './views/Home/alreadySponsor.vue'
import notSponsor from './views/Home/notSponsor.vue'
import alreadyAudit from './views/Home/alreadyAudit.vue'
import notAudit from './views/Home/notAudit.vue'
import Reply from './views/Home/Reply.vue'

/*------------------------设置----------------------------*/
import Set from './views/Header/Set.vue'//设置
import Client from './views/Set/Client.vue'//客户
import Supplier from './views/Set/Supplier.vue'//供应商
import Product from './views/Set/Product.vue'//产品
import Bank from './views/Set/Bank.vue'//银行
import Duty from './views/Set/Duty.vue'//银行
import AccountSubjectType from './views/Set/AccountSubjectType.vue'//会计科目类型
import AccountSubject from './views/Set/AccountSubject.vue'//会计科目
import BudgetAccount from './views/Set/BudgetAccount.vue'//预算科目
import CashFlowProject from './views/Set/CashFlowProject.vue'//现金流量项目
import BudgetAndCashflow from './views/Set/BudgetAndCashflow'//预算科目与现金流量对应关系
import BudgetAndSubject from './views/Set/BudgetAndSubject'//预算科目与会计科目对应关系
import AssistingAccountType from './views/Set/AssistingAccountType.vue'//辅助核算类型
import AssistingAccountProject from './views/Set/AssistingAccountProject.vue'//辅助核算项目
import SalesInvoiceInformation from './views/Set/SalesInvoiceInformation.vue'//销售发票资料
import EncodingSet from './views/Set/EncodingSet.vue'//编码设定
import SysParam from './views/Set/SysParam.vue'//系统参数
import ReportSet from './views/Set/ReportSet.vue'//报表设置
import Department from './views/Set/Department.vue'//部门


/*------------------------end----------------------------*/

import LedgerView from './views/Header/ledger.vue'
import budgetManage from './views/Header/budgetManage.vue'
import Expense from './views/Business/Expense.vue'
import borrowMoney from './views/Business/borrowMoney.vue'
import refundMoney from './views/Business/refundMoney.vue'
import Detail from './views/Business/Detail.vue'
import businessMain from './views/Business/businessMain.vue'
import Income from './views/Business/Income.vue'
import kongzhi from './views/budgetManage/kongzhi.vue'
import budgetAdjust from './views/budgetManage/budgetAdjust.vue'
import chaxunt from './views/budgetManage/chaxunt.vue'
import shenhet from './views/budgetManage/shenhet.vue'
import bianzhit from './views/budgetManage/bianzhit.vue'
import baobiao from './views/budgetManage/baobiao.vue'
import lilv from './views/budgetManage/lilv.vue'
import lizhi from './views/budgetManage/lizhi.vue'
import zijin from './views/budgetManage/zijin.vue'
import zizhi from './views/budgetManage/zizhi.vue'
import year from './views/budgetManage/year.vue'
import budgetMaster from './views/budgetManage/budgetMaster.vue'

/**
 * 总账
 */

//期初余额
import keeper from './views/LedgerView/keeper/keeper.vue'
import input from './views/LedgerView/keeper/input.vue'

//凭证
import proof from './views/LedgerView/proof/proof.vue'
import templates from './views/LedgerView/proof/templates.vue'

//财务处理
import finance from './views/LedgerView/finance/finance.vue'
import Accounting from './views/LedgerView/finance/Accounting.vue'

//报表
import cash from './views/LedgerView/forms/cash.vue'
import Lose from './views/LedgerView/forms/Lose.vue'
import profit from './views/LedgerView/forms/profit.vue'

//账簿
import Checkingdt from './views/LedgerView/account/Checkingdt.vue'
import Overall from './views/LedgerView/account/Overall.vue'
import Details from './views/LedgerView/account/Details.vue'
import SbjectBalanceTable from './views/LedgerView/account/SbjectBalanceTable.vue'
import staffArrears from './views/LedgerView/account/staffArrears.vue'
/**
 * end
 */

/**
 *  出纳
 */

import Work from './views/teller/Work.vue'
import Entrance from './views/teller/Entrance.vue'
import bookmoney from './views/teller/bookmoney.vue'
import bankbook from './views/teller/bankbook.vue'
import HistoryTable from './views/teller/HistoryTable.vue'

/**
 * end
 */

/**
 *  供应链管理
 */
import SupplyChainManage from './views/SupplyChain/SupplyChainManage.vue'
//采购管理
import SupplyChain from './views/Header/SupplyChain.vue'
import PurchaseManage from './views/SupplyChain/PurchaseManage/PurchaseManage.vue'//采购管理
import BOMPurchaseOrder from './views/SupplyChain/PurchaseManage/BOMPurchaseOrder.vue'//BOM采购订单
import PurchaseIn from './views/SupplyChain/PurchaseManage/PurchaseIn.vue'//采购入仓单
import PurchaseInvoice from './views/SupplyChain/PurchaseManage/PurchaseInvoice.vue'//采购发票
import PurchasePayment from './views/SupplyChain/PurchaseManage/PurchasePayment.vue'//付款单
import PurchaseOrder from './views/SupplyChain/PurchaseManage/PurchaseOrder.vue'//采购订单
import PurchaseImport from './views/SupplyChain/PurchaseManage/PurchaseImport.vue'//采购进货单

//销售管理
import SaleManage from './views/SupplyChain/SaleManage/SaleManage.vue'//采购管理
import SaleOrder from './views/SupplyChain/SaleManage/SaleOrder.vue'//销售订单
import SaleInvoice from './views/SupplyChain/SaleManage/SaleInvoice.vue'//销售发票
import SaleWarehouseReceipt from './views/SupplyChain/SaleManage/SaleWarehouseReceipt.vue'//销售出仓单
import RcvSingle from './views/SupplyChain/SaleManage/RcvSingle.vue'//收款单

import Index from './views/index.vue';

let routes = [
    {
        path: '/Login',
        component: Login,
        hidden: true
    },
    {   //选账套分支
        path: '/Branch',
        component: Branch,
        hidden: true,
    },
    {
        path: '/',
        component: Index,
        redirect: '/Home',
        beforeEnter: (to, from, next) => {
            if (!(sessionStorage.getItem('isLogin'))) {
                next('/login');
            } else {
                next();
            }
        },
        
        children: [
            {   //首页
                path: '/Home',component: Home,
                children: [          
                    { path:'/alreadySponsor',component: alreadySponsor },
                    { path:'/notSponsor',component: notSponsor },
                    { path:'/alreadyAudit',component: alreadyAudit },                    
                    { path:'/notAudit',component: notAudit},
                    { path:'/Reply',component: Reply},
                ]
            },
            {   //出纳
                path: '/Cashier', component: Cashier,
                children: [
                    { path: '/Entrance', component: Entrance },
                    { path: '/Work', component: Work, name: 'WorkRouter' },
                    { path: '/bookmoney', component: bookmoney },
                    { path: '/bankbook', component: bankbook },
                    { path: '/historyTable', component: HistoryTable }
                ],
            },
            {
                //业务单据类别
                path: '/Business', component: Business,
                children: [
                    { path: '/Expense', component: Expense },
                    { path: '/borrowMoney', component: borrowMoney },
                    { path: '/refundMoney', component: refundMoney },
                    { path: '/Income', component: Income },
                    { path: '/Detail', component: resolve => require(['./views/Business/Detail.vue'], resolve) },
                    { path: '/businessMain', component: resolve => require(['./views/Business/businessMain.vue'], resolve) },
                ]
            },
            {
                //设置
                path: '/Set', component: resolve => require(['./views/Header/Set.vue'], resolve),
                children: [                        
                    { path: '/Client', component: resolve => require(['./views/Set/Client.vue'], resolve) }, //客户
                    { path: '/Department', component: resolve => require(['./views/Set/Department.vue'], resolve)},//部门
                    { path: '/Supplier', component: resolve => require(['./views/Set/Supplier.vue'], resolve)  },//供应商
                    { path: '/Product', component: resolve => require(['./views/Set/Product.vue'], resolve) },//产品
                    { path: '/Bank', component: resolve => require(['./views/Set/Bank.vue'], resolve) }, //银行
                    { path: '/AccountSubjectType', component: resolve => require(['./views/Set/AccountSubjectType.vue'], resolve) },//会计科目类型
                    { path: '/AccountSubject', component: resolve => require(['./views/Set/AccountSubject.vue'], resolve) },//会计科目
                    { path: '/BudgetAccount', component: resolve => require(['./views/Set/BudgetAccount.vue'], resolve) },//预算科目
                    { path: '/CashFlowProject', component: resolve => require(['./views/Set/CashFlowProject.vue'], resolve) },//现金流量项目
                    { path: '/BudgetAndCashflow', component: resolve => require(['./views/Set/BudgetAndCashflow.vue'], resolve) },//预算与现金流关系
                    { path: '/BudgetAndSubject', component: resolve => require(['./views/Set/BudgetAndSubject.vue'], resolve) },//预算与科目关系
                    { path: '/AssistingAccountType', component: resolve => require(['./views/Set/AssistingAccountType.vue'], resolve) },//辅助核算类型
                    { path: '/AssistingAccountProject', component: resolve => require(['./views/Set/AssistingAccountProject.vue'], resolve) }, //辅助核算项目
                    { path: '/EncodingSet', component: resolve => require(['./views/Set/EncodingSet.vue'], resolve) }, //编码设置
                    { path: '/SysParam', component: resolve => require(['./views/Set/SysParam.vue'], resolve) }, //系统参数
                    { path: '/ReportSet', component: resolve => require(['./views/Set/ReportSet.vue'], resolve) }, //报表设置                    
                    { path: '/AnnounceList', component: resolve => require(['./views/Set/AnnounceList.vue'], resolve) }, //公告管理
                    { path: '/Duty', component: resolve => require(['./views/Set/Duty.vue'], resolve) }, //公告管理
                    { path: '/SalesInvoiceInformation', component: resolve => require(['./views/Set/SalesInvoiceInformation.vue'], resolve) } //销售发票资料
                ]
            },
            {
                path: '/LedgerView', component: LedgerView,   //总账类别
                children: [
                    /**
                     * 初期余额
                     */
                    { path: '/keeper', component: keeper },//凭证
                    { path: '/input', component: input },//模板
        
                    /**
                     * 账簿
                     */
                    { path: '/Checkingdt', component: Checkingdt },
                    { path: '/Overall', component: Overall },
                    { path: '/Details', component: Details },
                    { path: '/SbjectBalanceTable', component: SbjectBalanceTable },
                    { path: '/staffArrears', component: staffArrears },
        
                    /**
                     * 财务处理
                     */
                    { path: '/finance', component: finance },
                    { path: '/Accounting', component: Accounting },
        
                    /**
                     * 报表
                     */
                    { path: '/cash', component: cash },
                    { path: '/Lose', component: Lose },
                    { path: '/profit', component: profit },
        
                    /**
                     * 凭证
                     */
                    { path: '/proof', component: proof },
                    { path: '/templates', component: templates },
                ]
            },
            {
                path: '/budgetManage', component: budgetManage,//预算管理类别
                children: [
                    { path: '/baobiao', component: baobiao },
                    { path: '/kongzhi', component: kongzhi },
                    { path: '/budgetAdjust', component: budgetAdjust },
                    { path: '/lilv', component: lilv },
                    { path: '/lizhi', component: lizhi },
                    { path: '/zijin', component: zijin },
                    { path: '/zizhi', component: zizhi },
                    { path: '/bianzhit', component: bianzhit },
                    { path: '/shenhet', component: shenhet },
                    { path: '/chaxunt', component: chaxunt },
                    { path: '/budgetMaster', component: budgetMaster },
                    { path: '/year', component: year },
                ]
            },
            {
                path: '/SupplyChain', component: SupplyChain,//供应链管理
                children: [
                    { path: '/SupplyChainManage', component: SupplyChainManage },
                    //采购管理
                    { path: '/PurchaseManage', component: PurchaseManage },
                    { path: '/PurchaseIn', component: PurchaseIn },
                    { path: '/PurchaseInvoice', component: PurchaseInvoice },
                    { path: '/PurchasePayment', component: PurchasePayment },
                    { path: '/PurchaseImport', component: PurchaseImport },
                    { path: '/PurchaseOrder', component: PurchaseOrder },
                    { path: '/BOMPurchaseOrder', component: BOMPurchaseOrder },
                    //销售管理
                    { path: '/SaleManage', component: SaleManage },
                    { path: '/SaleWarehouseReceipt', component: SaleWarehouseReceipt },
                    { path: '/SaleOrder', component: SaleOrder },
                    { path: '/SaleInvoice', component: SaleInvoice },
                    { path: '/RcvSingle', component: RcvSingle },
                ]
            }
        ]
    },
    {
        path: '/404',
        component: NotFound,
        name: '',
        hidden: true
    },
];

export default routes;